﻿using UnityEngine;
using System.Collections;

namespace play {
	public class PlayerState : MonoBehaviour {
		public bool isAlive = true;
		public bool readyToFire = true;
		public bool hasInertia = false;
		public bool isImmune = true;	// 无敌

		// 无敌时间 2s
		public float immuneTime = 3f;
		// 复活的时间点
		public static float rebornTime = 0;

		//tank 移速
		public  float speed = 5.0f;

		//出雪地时的时间
		public  float preTime = 0;
		//默认方向朝上
		public int direction = 1;


		void Update() {
//print (Time.time);
			// 更新无敌状态
			if (isImmune == true && Time.time >= rebornTime + immuneTime) {
				isImmune = false;
//print("无敌时间过了");
				// 隐藏无敌罩罩
				Transform child = transform.GetChild(0);
				SpriteRenderer immnueMask = child.GetComponent<SpriteRenderer>();
				immnueMask.sprite = null;
			}
		}
	}
}